package stack

import "jvmgo/ch09/instructions/base"
import "jvmgo/ch09/rtda"

//交换操作数栈顶的两个值
type SWAP struct {
    base.NoOperandsInstruction
}

func (self *SWAP) Execute(frame *rtda.Frame) {
    stack := frame.OperandStack()
    slot1 := stack.PopSlot()
    slot2 := stack.PopSlot()
    stack.PushSlot(slot1)
    stack.PushSlot(slot2)
}
